<!-- 登录 -->
<template>
  <div class="container">
    <van-nav-bar title="登录"  left-arrow />
    <button @click="sendMsg()">登录页</button>
    <button @click="login()">登录</button>
    <button @click="jump()">跳转</button>
    <van-field v-model.trim="text" label="文本" />
  </div>
</template>

<script>
import { getSmsCode } from '@/api/login';
import { LOGIN } from '@/store/modules/user';
export default {
  name: 'login',
  components: {},
  data() {
    return {
      text:""
    };
  },

  computed: {},

  mounted() {},

  methods: {
    sendMsg() {
      let smsParm = {
        phone: '13552676928',
      };
      getSmsCode(smsParm)
        .then((res) => {
          if (res.code == 200) {
            console.log('error');
          } else {
            console.log('error2');
          }
        })
        .catch((error) => {
          console.log(error);
        });
    },
    login() {
      const loginParm = {
        phone: '13552676928',
        requestId: '1',
        code: '1234',
      };
      this.$store
        .dispatch(LOGIN, loginParm)
        .then(() => {
          this.$toast('err');
        })
        .catch((err) => {
          this.$toast(err);
        });
    },
    jump(){
      this.$router.push("/Home");
    }
  },
};
</script>
<style lang='less' scoped>
.container > p {
  color: red;
  font-size: 20px;
}
</style>